<?php
include('../../inc/global.inc');
include("../islogin.php");
$url=$_SERVER['HTTP_REFERER'];
?>
<?php
if($_POST[act_tj]){
$hot_id =$_POST['hot_id'];
$hot_name =$_POST['hot_name'];
$hot_ping =$_POST['hot_ping'];
mysql_query("insert into hot_product (hot_id,hot_name,hot_ping) values ('$_POST[hot_id]','$_POST[hot_name]','$hot_ping')");

echo "<script>location='".$_POST[url]."';</script>";
}
?>
<?php
if($_POST['act_xg']){
$hot_id =$_POST['hot_id'];
$hot_name =$_POST['hot_name'];
$hot_ping =$_POST['hot_ping'];
mysql_query("update hot_product set hot_name='$_POST[hot_name]',hot_id='$_POST[hot_id]',hot_ping='$hot_ping' where id='".$_POST['iid']."'");

echo "<script>location='".$_POST[url]."';</script>";
}
?>
<HTML>
<HEAD>
<TITLE>Admin</TITLE>
<META http-equiv=Content-Type content="text/html; charset=utf-8">
<LINK href="../css/css.css" rel=stylesheet>
<script type='text/javascript' src="../js/islogin.js" charset="gb2312"></script>
</HEAD>
<BODY>
<center>
  <table width="600" border="0" cellpadding="0" cellspacing="1" bgcolor="#000000">
    <tr>
      <td height="25" bgcolor="#EEEEF9" style="padding-left:5px;">添加、修改产品目录&nbsp;&nbsp;<a href="javascript:history.go(-1)">返回</a></td>
    </tr>
  </table>
<?php
if($_GET[tj]){
?>
  <table width="600" border="0" cellpadding="0" cellspacing="1" bgcolor="#000000">
  <form method="post" action="catalog_modifyhot.php" onSubmit="return check()" name="form1">
<tr>
      <td width="26%" height="30" align="center" bgcolor="#FFFFFF">热点产品名称</td>
      <td width="74%" align="left" bgcolor="#FFFFFF" style="padding-left:2px;"><input name="hot_name" type="text" id="hot_name" value="<?=$row[hot_name]?>" size="20" >
         </td>
    </tr>
      <tr>
        <td width="27%" height="30" align="center" bgcolor="#FFFFFF">热点产品目录名称</td>
        <td width="73%" align="left" bgcolor="#FFFFFF" style="padding-left:2px;"><input name="hot_ping" type="text" value="<?=$row[hot_ping]?>" size="30"></td>
      </tr>
      <tr>
        <td height="30" align="center" bgcolor="#FFFFFF">上级目录</td>
        <td align="left" bgcolor="#FFFFFF" style="padding-left:2px;"><select name="hot_id">
            <option value="0">--选择上级目录--</option>
  <?php
  $sql2="select * from hot_product where hot_id=0 order by id asc";
  $rs2=mysql_query($sql2);
  while($row2=mysql_fetch_array($rs2))
  {
  ?>
         <option value="<?=$row2['id']?>" <?php if($_GET[id]==$row[hot_id]){echo "selected";}?>><?=$row2[hot_name]?></option>
  <?php
  }
  mysql_free_result($rs2);
  ?>
        </select></td>
      </tr>
    <tr><input type="hidden" name="url" value="<?=$url?>">
	<input type="hidden" name="act_tj" value="ok">
      <td height="30" colspan="2" align="center" bgcolor="#FFFFFF"><input type="submit" value="提交"></td>
    </tr>
	</form>
  </table>
  <?php
}
?>
  <?php
if($_GET['xg']){
$sql="select * from hot_product where id=".$_GET['xg_id'];
$rs=mysql_query($sql);
$row=mysql_fetch_array($rs)
?>
<table width="600" border="0" cellpadding="0" cellspacing="1" bgcolor="#000000">
    <form method="post" action="catalog_modifyhot.php" onSubmit="return check()" name="form1">
      <tr>
        <td height="30" colspan="2" align="center" bgcolor="#8DA8CF">修改热点产品目录</td>
      </tr>
	<tr>
      <td width="26%" height="30" align="center" bgcolor="#FFFFFF">热点产品名称</td>
      <td width="74%" align="left" bgcolor="#FFFFFF" style="padding-left:2px;"><input name="hot_name" type="text" id="hot_name" value="<?=$row[hot_name]?>" size="20" >
         </td>
    </tr>
      <tr>
        <td width="27%" height="30" align="center" bgcolor="#FFFFFF">热点产品目录名称</td>
        <td width="73%" align="left" bgcolor="#FFFFFF" style="padding-left:2px;"><input name="hot_ping" type="text" value="<?=$row[hot_ping]?>" size="30"></td>
      </tr>
      <tr>
        <td height="30" align="center" bgcolor="#FFFFFF">上级目录</td>
        <td align="left" bgcolor="#FFFFFF" style="padding-left:2px;"><select name="hot_id">
            <option value="0">--选择上级目录--</option>
  <?php
  $sql2="select * from hot_product where hot_id=0 order by id asc";
  $rs2=mysql_query($sql2);
  while($row2=mysql_fetch_array($rs2))
  {
  ?>
         <option value="<?=$row2['id']?>" <?php if($row2[id]==$row[hot_id]){echo "selected";}?>><?=$row2[hot_name]?></option>
  <?php
  }
  mysql_free_result($rs2);
  ?>
        </select></td>
      </tr>
      <tr><input type="hidden" name="url" value="<?=$url?>">
        <input type="hidden" name="act_xg" value="ok"><input type="hidden" name="iid" value="<?=$row['id']?>">
        <td height="30" colspan="2" align="center" bgcolor="#FFFFFF"><input name="submit" type="submit" value="提交"></td>
      </tr>
    </form>
  </table>
  <?php
}?>
<br>
<span style="color:#990000">二级可以随便移动 大类禁止移动</span>
</center>
</BODY>
</HTML>
